<%@ page language="java" contentType="text/html; charset=utf-8" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<jsp:useBean id="bb" class="weaver.general.BaseBean"/>
<%@ page import="com.alibaba.fastjson.JSONObject" %>
<%@ page import="weaver.general.Util" %>
<%@ page import="com.alibaba.fastjson.JSONArray" %>
<%@ page import="org.apache.commons.lang3.StringUtils" %>
<%@ page import="weaver.conn.RecordSet" %>
<%--月度考勤汇总表--%>
<%
    JSONObject jsonData = new JSONObject();
    JSONArray dataList = new JSONArray();
    String yf = Util.null2String( request.getParameter( "yf" ) );
    String[] userList = request.getParameterValues( "userList" );
    String users = StringUtils.join( userList, "," );
    rs.executeQuery( "select xm,sum(nvl(bj,0)) as bj,sum(nvl(sj2,0)) as sj2,sum(nvl(hj,0)) as hj,sum(nvl(sj,0)) as sj,\n" +
            "sum(nvl(tqj,0)) as tqj,sum(nvl(jhsyj,0)) as jhsyj,sum(nvl(hlj,0)) as hlj,sum(nvl(gsj,0)) as gsj,\n" +
            "sum(nvl(nxj,0)) as nxj,sum(nvl(cj,0)) as cj,sum(nvl(dxt,0)) as dxt \n" +
            "from(\n" +
            "select xm,bj,sj2,hj,sj,tqj,jhsyj,hlj,gsj,nxj,cj,dxt from formtable_main_238_dt1 where xm in ("+users+") and yf='"+yf+"' \n" +
            "union\n" +
            "select xm,bj,sj2,hj,sj,tqj,jhsyj,hlj,gsj,nxj,cj,dxt from formtable_main_235_dt1 where xm in ("+users+") and yf='"+yf+"' \n" +
            ") group by xm", yf );
    while (rs.next()) {
        JSONObject json = new JSONObject();
        json.put( "xm", Util.null2String( rs.getString( "xm" ) ) );//姓名
        json.put( "bj", Util.null2String( rs.getString( "bj" ) ) );//病假
        json.put( "sj2", Util.null2String( rs.getString( "sj2" ) ) );//事假
        json.put( "hj", Util.null2String( rs.getString( "hj" ) ) );//婚假
        json.put( "sj", Util.null2String( rs.getString( "sj" ) ) );//丧假
        json.put( "tqj", Util.null2String( rs.getString( "tqj" ) ) );//探亲假
        json.put( "jhsyj", Util.null2String( rs.getString( "jhsyj" ) ) );//计划生育假
        json.put( "gsj", Util.null2String( rs.getString( "gsj" ) ) );//工伤假
        json.put( "nxj", Util.null2String( rs.getString( "nxj" ) ) );//年休假
        json.put( "cj", Util.null2String( rs.getString( "cj" ) ) );//产假
        json.put( "dxt", Util.null2String( rs.getString( "dxt" ) ) );//调休天
        dataList.add( json );
    }
    jsonData.put( "dataList", dataList );
    out.print( jsonData.toJSONString() );
    bb.writeLog( "getInvoice_Ajax=" + jsonData.toJSONString() );
%>
